import 'dart:io';

import 'package:flutter_base/pages/home/entitys/MessageEntity.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';

const PAGE_SIZE = 10;
const PAGE_INDEX = 1;

class HoneTabPage extends StatefulWidget {
  final String? title;

  const HoneTabPage({Key? key, this.title}) : super(key: key);

  @override
  _HoneTabPageState createState() => _HoneTabPageState();
}

class _HoneTabPageState extends State<HoneTabPage>
    with SingleTickerProviderStateMixin, AutomaticKeepAliveClientMixin {
  @override
  bool get wantKeepAlive => true;
  RefreshController? _refreshController;
  List<MessageEntity> _list = [
    MessageEntity(title: '中国机械联四届九次理事会 四届八次会员大会文件'),
    MessageEntity(title: '关于张克林副会长等出访澳门的公示'),
    MessageEntity(title: '王会长在2019年工作总结会上的讲话及相关文件'),
    MessageEntity(title: '关于发送政府部门座谈会邀请函的通知'),
    MessageEntity(title: '中国船舶集团有限公司关于总部办公地址有关事项的函'),
  ];

  @override
  void initState() {
    _refreshController = new RefreshController();
    super.initState();
  }

  @override
  void dispose() {
    // TODO: implement dispose
    _refreshController?.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.white,
      body: ListView.separated(
          itemCount: _list.length,
          itemBuilder: (context, index) {
            return Container(
              color: Colors.white,
              padding: const EdgeInsets.symmetric(vertical: 0, horizontal: 0),
              child: ListTile(
                title: Padding(
                  padding: const EdgeInsets.fromLTRB(0, 1, 0, 4),
                  child: Text(_list[index].title),
                ),
                subtitle: Padding(
                  padding: const EdgeInsets.fromLTRB(0, 4, 0, 1),
                  child: Row(
                    children: <Widget>[
                      Icon(
                        Icons.access_time,
                        color: Colors.grey,
                        size: 14,
                      ),
                      Text(
                        '2021-06-10 09:45:13',
                        style: TextStyle(
                          color: Color(0xffb6b6b6),
                        ),
                      ),
                    ],
                  ),
                ),
              ),
            );
          },
          separatorBuilder: (BuildContext context, int index) {
            return Container(
                padding: const EdgeInsets.symmetric(horizontal: 16),
                child: Divider(
//                    color: Color(0xfff2f2f2),
                  color: Colors.grey,
                  height: 0,
                ));
          }),
    );
  }
}
